﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MyBehaviorTree
{
    public class Condition : Behavior
    {
        public Condition() : base() { }
    }

    public class FCondition : Condition
    {
        readonly Func<BlackBoard, bool> condition;
        public FCondition(Func<BlackBoard,bool> condition):base()
        {
            this.condition = condition;
        }

        public override State update()
        {
            if (condition(blackBoard))
            {
                return State.SUSCCESS;
            }
            return State.FAILURE;
        }
    }
}
